<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>The DOMNodeList class</title>
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-base.css" />
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-medium.css" />

 </head>
 <body class="docs"><div class="navbar navbar-fixed-top">
  <div class="navbar-inner clearfix">
    <ul class="nav" style="width: 100%">
      <li style="float: left;"><a href="domnode.replacechild.html">« DOMNode::replaceChild</a></li>
      <li style="float: right;"><a href="domnodelist.count.html">DOMNodeList::count »</a></li>
    </ul>
  </div>
</div>
<div id="breadcrumbs" class="clearfix">
  <ul class="breadcrumbs-container">
    <li><a href="index.html">PHP Manual</a></li>
    <li><a href="book.dom.html">DOM</a></li>
    <li>The DOMNodeList class</li>
  </ul>
</div>
<div id="layout">
  <div id="layout-content"><div id="class.domnodelist" class="reference">
 <h1 class="title">The DOMNodeList class</h1>
 
 
 <div class="partintro"><p class="verinfo">(PHP 5, PHP 7, PHP 8)</p>
 



 
  <div class="section" id="domnodelist.synopsis">
   <h2 class="title">类摘要</h2>
 

   <div class="classsynopsis">
    <div class="ooclass">
     
    </div>

    <div class="classsynopsisinfo">
     <span class="ooclass">
      <span class="modifier">class</span> <strong class="classname">DOMNodeList</strong>
     </span>

     <span class="oointerface"><span class="modifier">implements</span> 
       <a href="class.iteratoraggregate.html" class="interfacename">IteratorAggregate</a></span><span class="oointerface">,  <a href="class.countable.html" class="interfacename">Countable</a></span> {</div>

    <div class="classsynopsisinfo classsynopsisinfo_comment">/* 属性 */</div>
    <div class="fieldsynopsis">
     <span class="modifier">public</span>
     <span class="modifier">readonly</span>
     <span class="type">int</span>
      <var class="varname"><a href="class.domnodelist.html#domnodelist.props.length">$<var class="varname">length</var></a></var>;</div>


    <div class="classsynopsisinfo classsynopsisinfo_comment">/* 方法 */</div>
    <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="methodname"><a href="domnodelist.count.html" class="methodname">count</a></span>(): <span class="type">int</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="domnodelist.item.html" class="methodname">item</a></span>(<span class="methodparam"><span class="type">int</span> <code class="parameter">$index</code></span>): <span class="type"><span class="type"><a href="class.domnode.html" class="type DOMNode">DOMNode</a></span>|<span class="type"><span class="type DOMNameSpaceNode">DOMNameSpaceNode</span></span>|<span class="type">null</span></span></div>

   }</div>

 
  </div>
 

  <div class="section" id="domnodelist.props">
   <h2 class="title">属性</h2>
   <dl>
    
     <dt id="domnodelist.props.length"><var class="varname">length</var></dt>

     <dd>

      <p class="para">
       The number of nodes in the list. The range of valid child node 
       indices is 0 to <code class="literal">length - 1</code> inclusive.
      </p>
     </dd>

    
   </dl>

  </div>

  <div class="section" id="domnodelist.changelog">
   <h2 class="title">更新日志</h2>
   <p class="para">
    <table class="doctable informaltable">
     
      <thead>
       <tr>
        <th>版本</th>
        <th>说明</th>
       </tr>

      </thead>

      <tbody class="tbody">
       <tr>
        <td>8.0.0</td>
        <td>
         <span class="classname"><strong class="classname">DOMNodeList</strong></span> implements
         <span class="interfacename"><a href="class.iteratoraggregate.html" class="interfacename">IteratorAggregate</a></span> now.
         Previously, <span class="interfacename"><a href="class.traversable.html" class="interfacename">Traversable</a></span> was implemented instead.
        </td>
       </tr>

       <tr>
        <td>7.2.0</td>
        <td>
         The <span class="classname"><a href="class.countable.html" class="classname">Countable</a></span> interface is implemented and 
         returns the value of the <a href="class.domnodelist.html#domnodelist.props.length" class="link">length</a> property.
        </td>
       </tr>

      </tbody>
     
    </table>

   </p>
  </div>

 
  <div class="section">
   <h2 class="title">参见</h2>
   <p class="para">
    <ul class="simplelist">
     <li class="member"><a href="http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-536297177" class="link external">&raquo;&nbsp;W3C specification of NodeList</a></li>
    </ul>
   </p>
  </div>
  

 </div>
 
 










 
<h2>目录</h2><ul class="chunklist chunklist_reference"><li><a href="domnodelist.count.html">DOMNodeList::count</a> — Get number of nodes in the list</li><li><a href="domnodelist.item.html">DOMNodeList::item</a> — Retrieves a node specified by index</li></ul>
</div>
</div></div></body></html>